﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chapter_6
{
    public class Vector
    {
        private double x = 0;
        private double y = 0;
        private double z = 0;

        public Vector(double x, double y, double z)
        {
            this.x = x;
            this.y = y;
            this.z = z;
        }

        public Vector(Vector rhs)
        {
            x = rhs.x;
            y = rhs.y;
            z = rhs.z;
        }

        public static Vector operator + (Vector lhs, Vector rhs)
        {
            Vector result = new Vector(lhs);
            result.x += rhs.x;
            result.y += rhs.y;
            result.z += rhs.z;

            return result;
        }

        public override string ToString()
        {
            return String.Format("The vector value is:\nx:{0}\ny:{1}\nz:{2}",x,y,z);
        }
    }
}
